import 'dart:convert';

import 'package:android_intent_plus/android_intent.dart';
import 'package:bruno/bruno.dart';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:sph_shipper/AppConfig/LocalStorage.dart';
import 'package:sph_shipper/http/getapi.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../AppConfig/Config.dart';
import '../../AppConfig/RouteAct.dart';
import '../../AppConfig/ShowDialog.dart';
import '../../Main/ProtocolDisplay.dart';
import '../../SendGoods/DesignatedDriver.dart';
import '../../TabBar/TabbarView.dart';
import '../../http/NoLoadingGetApi.dart';
import '../../http/api.dart';
import 'CancelWaybillPrompt.dart';
import 'ModifyTransportationAgreement.dart';
import 'TransportProtocolNodes.dart';
import 'package:platform/platform.dart';
class UnconfirmedTransportationAgreement extends StatefulWidget {
  const UnconfirmedTransportationAgreement({super.key, required this.wayBillId, required this.Type});
    final String wayBillId;
    //1.生成协议  2.修改协议
    final int Type;
  @override
  State<UnconfirmedTransportationAgreement> createState() => _UnconfirmedTransportationAgreementState();
}

class _UnconfirmedTransportationAgreementState extends State<UnconfirmedTransportationAgreement> {
  @override
  Map dataMap={};
  bool isAgree=true;
  void initState() {
    // TODO: implement initState
    super.initState();
    getContractAct();
  }
  void getContractAct(){
    NoLoadinggetApiManager.getData(
      context,
      "api/waybill/contract/unsigned",
      {"waybillId":widget.wayBillId,},
          (responseData)  {
        setState(() {
          dataMap=responseData['data'];
          print(dataMap['updateInfo']);
          if(dataMap['contract']['updateInfo']!=null&&dataMap['contract']['mode']=="DRIVER"){
            showModalBottomSheet(context: context, builder: (BuildContext context)
            {
              return ChangeSheet(dataMap: dataMap);
            }
            );
          }
        });
      },
    );
  }
  _makePhoneCall(String phoneNumber) async {
    if (LocalPlatform().isAndroid) {
      var status = await Permission.phone.status;
      if (status.isGranted) {
        // 权限已被授予
        // callPhone();
        final AndroidIntent intent = AndroidIntent(
          action: 'android.intent.action.CALL',
          data: Uri.encodeFull('tel:$phoneNumber'),
        );
        await intent.launch();
      } else if (status.isDenied) {
        // 权限被拒绝，但用户可以再次授权
        showCallPhoneFirstDialog(context);
        status = await Permission.phone.request();
        if (status.isGranted) {
          // 用户同意了权限
          // callPhone();
          final AndroidIntent intent = AndroidIntent(
            action: 'android.intent.action.CALL',
            data: Uri.encodeFull('tel:$phoneNumber'),
          );
          await intent.launch();
        } else {
          showCallPhoneDialog(context);
          // 用户拒绝权限，无法发起电话
          // 可以在此处展示信息提示用户需要权限
        }
      } else if (status.isPermanentlyDenied) {
        // 权限被永久拒绝，需要用户手动开启权限
        showCallPhoneDialog(context);
      }

    }else{
      final url =Uri.parse('tel:$phoneNumber');
      if (await canLaunchUrl(url)) {
        await launchUrl(url);
      } else {
        throw '无法拨打电话：$url';
      }
    }
  }
  Future<void> cancelAction(String waybillId,int cancelStatus) async {


  }
  Future<void> refuseShprAction(int refuseStatus) async {

  }
  Future<void> refuseAction() async {
    getApiManager.getData(
      context, // 上下文对象，用于显示提示信息等
      'api/waybill/contract/refuse', // 您的API端点
      {"id":dataMap['contract']['id']}, // 查询参数，如果没有可以传递null
          (responseData)  {
        BrnToast.show(
          "操作成功",
          context,
          duration: BrnDuration.short,
        );
        Navigator.pushReplacement(
          context,
          MaterialPageRoute(builder: (context) => TabbarView(pateIndex: 2,),fullscreenDialog: true,),
        );
      },
    );
  }
  Future<void> argeeAct() async {
    getApiManager.getData(
      context, // 上下文对象，用于显示提示信息等
      'api/waybill/contract/agree', // 您的API端点
      {"id":dataMap['contract']['id']}, // 查询参数，如果没有可以传递null
          (responseData)  {
        BrnToast.show(
          "操作成功",
          context,
          duration: BrnDuration.short,
        );
        Navigator.pushReplacement(
          context,
          MaterialPageRoute(builder: (context) => TabbarView(pateIndex: 2,),fullscreenDialog: true,),
        );
      },
    );
  }
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text("货物运输协议",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
        leading: IconButton(
          onPressed: () {
            Navigator.pop(context);
          },
          icon: Icon(Icons.arrow_back_ios),
        ),
      ),
      body:dataMap.isEmpty?Container():  Column(
        children: [
          Expanded(
            child:ListView(
              children: [
      
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 24.w,top: 10.h,bottom: 10.h,right: 20.w),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    gradient: LinearGradient(
                      begin: Alignment.centerLeft,
                      end: Alignment.centerRight,
                      colors: [Color.fromRGBO(253,252,248,1), Color.fromRGBO(251,236,228,1)],
                    ),
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Icon(Icons.query_builder,color: MyColors.textColor,),
                          SizedBox(width: 4.w,),
                          Text(dataMap['contract']['mode']=="DRIVER"?"待确认...":"待司机确认",style: TextStyle(color: Colors.black,fontSize: 16.sp),),
                        ],
                      ),
                      if(dataMap['ineffectiveNum']!=null&&dataMap['ineffectiveNum']>0)
                      GestureDetector(
                        child: Row(
                          children: [
                            Text("历史协议",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                            Icon(Icons.arrow_forward_ios,color: MyColors.textColor,size: 14,),
                          ],
                        ),
                        onTap:(){
                          Navigator.push(context, FadeRoute(page: TransportProtocolNodes(
                            waybillId: dataMap['contract']['waybillId'],
                          )));

                      }
                      )
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 9.w,top: 7.h,bottom: 8.h,right: 10.w),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    children: [
                      if(dataMap['contract']['contractInfo']['deposit']!=null&&dataMap['contract']['contractInfo']['deposit']!=0)
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("订金",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                                Text(dataMap['contract']['contractInfo']['depositType']==0? "(退还)":dataMap['contract']['contractInfo']['depositType']==1? "(不退还)":"",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],
                            ),
                            Text((dataMap['contract']['contractInfo']['depositType']==-1?"无订金":(dataMap['contract']['contractInfo']['deposit']).toString()+"元"),style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          ],
                        ),
                      if(dataMap['contract']['contractInfo']['deposit']!=null&&dataMap['contract']['contractInfo']['deposit']!=0)
                        SizedBox(height: 8.h,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [

                          Text("运费",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                          Text((dataMap['contract']['contractInfo']['freight']).toString()+"元",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [

                          Text("付款周期",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']<366)
                            Text("货到"+dataMap['contract']['contractInfo']['payPeriod'].toString()+"天后付",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']==801)
                            Text("货到付",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']==802)
                            Text("回单付",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']==830)
                            Text("月结",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']==890)
                            Text("季结",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                          if(dataMap['contract']['contractInfo']['payPeriod']==980)
                            Text("半年结",style: TextStyle(color: Colors.black,fontSize: 14.sp),),

                        ],
                      ),
                      // Divider(height: 16.h,color: MyColors.backgreyColor,),
                      // Row(
                      //   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      //   children: [
                      //     Row(
                      //       children: [
                      //         Text("总费用",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 18.sp),),
                      //         Text("(不包含订金)",style: TextStyle(color: Colors.black,),),
                      //       ],
                      //     ),
                      //     Text((dataMap['totalAmount']).toString()+"元",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                      //   ],
                      // ),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 7.w,top: 9.h,bottom: 8.h),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("车货信息",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      Row(
                        children: [
                          Text("货物信息",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 20.w,),
                          RichText(
                            text:TextSpan(children: [
                              if(dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoName']!=null)
                                TextSpan(
                                    text: dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoName'],
                                    style: TextStyle(fontSize: 13.sp, color:Colors.black)),
                              if(dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['packageType']!=null)
                                TextSpan(
                                    text:","+  dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['packageType'],
                                    style: TextStyle(fontSize: 13.sp, color:Colors.black)),
                              if(dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoWeight']!=0&&dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoWeight']!=null)
                                TextSpan(
                                    text: ","+ dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoWeight'].toString()+"吨",
                                    style: TextStyle(fontSize: 13.sp, color:Colors.black)),
                              if(dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoVolume']!=0&&dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoVolume']!=null)
                                TextSpan(
                                    text:","+ dataMap['contract']['contractInfo']['goodsInfo']['cargoInfo'][0]['cargoVolume'].toString()+"方",
                                    style: TextStyle(fontSize: 13.sp, color:Colors.black)),
                            ],
                            ),
                          ),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        children: [
                          Text("车长车型",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 20.w,),
                          Text(dataMap['contract']['contractInfo']['vehicleInfo']['vehicleLength']+"米/"+dataMap['contract']['contractInfo']['vehicleInfo']['vehicleModel'],style: TextStyle(fontSize: 13.sp,color:Colors.black),),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        children: [
                          Text("备注       ",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 20.w,),
                          Container(
                            width: screenSize.width-120.w,
                            child:Text(dataMap['contract']['contractInfo']['remark']==null?"未约定":dataMap['contract']['contractInfo']['remark'],style: TextStyle(fontSize: 13.sp,color:Colors.black),),
                          )

                        ],
                      ),
                    ],
                  ),
                ),

                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 7.w,top: 9.h,bottom: 8.h),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("装卸信息",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      Row(
                        children: [
                          Text("装货时间",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 19.w,),
                          Text(dataMap['contract']['contractInfo']['goodsInfo']['loadDay']+" "+dataMap['contract']['contractInfo']['goodsInfo']['loadTime']+"点装货",style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text("装货地址",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 19.w,),
                          Container(
                            width: screenSize.width-100.w,
                            child: Text(dataMap['contract']['contractInfo']['goodsInfo']['loadPlaceInfo'][0]['address'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                          ),

                        ],
                      ),
                      if(dataMap['contract']['contractInfo']['goodsInfo']['loadPlaceInfo'].length==2)
                        Column(
                          children: [
                            SizedBox(height: 8.h,),
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text("装货地址",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                SizedBox(width: 19.w,),
                                Container(
                                  width: screenSize.width-100.w,
                                  child: Text(dataMap['contract']['contractInfo']['goodsInfo']['loadPlaceInfo'][1]['address'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                                ),

                              ],
                            ),
                          ],
                        ),
                      SizedBox(height: 8.h,),
                      Row(
                        children: [
                          Text("卸货时间",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 19.w,),
                          Text(dataMap['contract']['contractInfo']['goodsInfo']['unloadDay']==null?"未约定，如需约定请修改协议":dataMap['contract']['contractInfo']['goodsInfo']['unloadDay']+" "+dataMap['contract']['contractInfo']['goodsInfo']['unloadTime']+"点卸货",style: TextStyle(color:dataMap['unloadTime']==null?  MyColors.themeColor:Colors.black,fontSize: 13.sp),),
                        ],
                      ),
                      SizedBox(height: 8.h,),
                      Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text("卸货地址",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                          SizedBox(width: 19.w,),
                          Container(
                            width: screenSize.width-100.w,
                            child: Text(dataMap['contract']['contractInfo']['goodsInfo']['unloadPlaceInfo'][0]['address'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                          ),
                        ],
                      ),
                      if(dataMap['contract']['contractInfo']['goodsInfo']['unloadPlaceInfo'].length==2)
                        Column(
                          children: [
                            SizedBox(height: 8.h,),
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text("卸货地址",style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                SizedBox(width: 19.w,),
                                Container(
                                  width: screenSize.width-100.w,
                                  child: Text(dataMap['contract']['contractInfo']['goodsInfo']['unloadPlaceInfo'][1]['address'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                                ),

                              ],
                            ),
                          ],
                        ),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 7.w,top: 9.h,bottom: 8.h,right:23.w ),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("托运人",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("姓名",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text("联系电话",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  // SizedBox(height: 8.h,),
                                  // Text("确认时间",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                ],
                              ),
                              SizedBox(width: 19.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text(dataMap['contract']['contractInfo']['shipperInfo']['realName'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text(dataMap['contract']['contractInfo']['shipperInfo']['phoneNum'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  // SizedBox(height: 8.h,),
                                  // Text(dataMap['createTime'],style: TextStyle(color: Colors.black,fontSize: 13.sp),),
                                ],
                              ),

                            ],
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(10.0), // 设置圆角半径为 10
                            child:  Image.network(MyServiceUrl.imgHeader+dataMap['contract']['contractInfo']['shipperInfo']['avatarPath'],
                              width: 40.w, // 图片的宽度
                              height: 40.h, // 图片的高度
                              fit: BoxFit.cover, // 图片的适应方式
                            ),
                          ),

                        ],
                      )
                    ],
                  ),
                ),
                if(dataMap['contract']['type']=="WLHY")
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 7.w,top: 9.h,bottom: 11.h,right:23.w ),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text("托运人",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      Text("速配货平台（浙江速搜物流股份有限公司）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                  padding: EdgeInsets.only(left: 7.w,top: 9.h,bottom: 8.h,right:23.w ),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.white,
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(dataMap['contract']['type']=="WLHY"?"实际承运人":"承运人",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("姓名",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text("联系电话",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text("车牌号",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  // SizedBox(height: 8.h,),
                                  // Text("确认时间",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                ],
                              ),
                              SizedBox(width: 19.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text(dataMap['contract']['contractInfo']['driverInfo']['realName'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text(dataMap['contract']['contractInfo']['driverInfo']['phoneNum'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  SizedBox(height: 8.h,),
                                  Text(dataMap['contract']['contractInfo']['vehicleInfo']['vehicleNum'],style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  // SizedBox(height: 8.h,),
                                  // Text("",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                ],
                              ),

                            ],
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(10.0), // 设置圆角半径为 10
                            child:  Image.network(MyServiceUrl.imgHeader+dataMap['contract']['contractInfo']['driverInfo']['avatarPath'],
                              width: 40.w, // 图片的宽度
                              height: 40.h, // 图片的高度
                              fit: BoxFit.cover, // 图片的适应方式
                            ),
                          ),

                        ],
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),

          if(dataMap['contract']['mode']=="DRIVER")
          Container(
            height: 90.h,
            color: Colors.white,
            padding: EdgeInsets.only(left: 15.w,right: 15.w,top:8.h,bottom:20.h ),
            child: Column(
    children: [
      GestureDetector(
        child:Row(
          children: [
            Icon(isAgree?Icons.radio_button_checked: Icons.radio_button_off,color: isAgree?MyColors.themeColor: MyColors.authTipColor,size: 20,),
            Text("我已阅读并同意",style: TextStyle(color:Colors.black,fontSize: 12.sp),),
            GestureDetector(
              child: Text("《货物运输协议》",style: TextStyle(color: MyColors.blueColor,fontSize: 12.sp),),
              onTap: (){
                Navigator.push( context, FadeRoute(page:ProtocolDisplay(id: "1805851815423774721",)));
              },
            ),
            GestureDetector(
              child: Text("《ETC取票规则》",style: TextStyle(color: MyColors.blueColor,fontSize: 12.sp),),
              onTap: (){
                Navigator.push( context, FadeRoute(page:ProtocolDisplay(id: "1805855371287597058",)));
              },
            ),
          ],
        ) ,
        onTap: (){
          setState(() {
            isAgree=!isAgree;
          });
        },
      ),
            SizedBox(height: 10.h,),
            Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                if(dataMap['ineffectiveNum']<1)
                BrnSmallOutlineButton(
                  title: '拒绝',
                  lineColor: MyColors.themeColor,
                  textColor: MyColors.themeColor,
                  radius: 30,
                  width: (screenSize.width-50.w)/3,
                  fontSize: 14.sp,
                  onTap: () {
                    refuseAction();
                  },
                ),
                SizedBox(width: 10.w,),
                BrnSmallMainButton(
                  title: '同意',
                  bgColor:MyColors.themeColor,
                  radius: 30,
                  fontSize: 14.sp,
                  width: (screenSize.width-50.w)/3,
                  onTap: ()  {
                    if(isAgree) {
                      argeeAct();
                    }else{
                      BrnToast.show("请阅读并同意协议内容", context,);
                    }
                  },
                ),
                SizedBox(width: 10.w,),
                if(dataMap['ineffectiveNum']>0)
                BrnSmallMainButton(
                  title: '修改协议',
                  bgColor:MyColors.themeColor,
                  radius: 30,
                  fontSize: 14.sp,
                  width:(screenSize.width-50.w)/3,
                  onTap: () async {
                    Navigator.push( context, FadeRoute(page:ModifyTransportationAgreement(dataMap: dataMap,)));
                  },
                ),
              ],
            ),
              ]
            ),
          ),
          if(dataMap['contract']['mode']=="SHIPPER")
            Container(
              height: 90.h,
              color: Colors.white,
              padding: EdgeInsets.only(left: 15.w,right: 15.w,top:8.h,bottom: 20.h ),
              child: Column(
                children: [
                  GestureDetector(
                    child:Row(
                      children: [
                        Icon(isAgree?Icons.radio_button_checked: Icons.radio_button_off,color: isAgree?MyColors.themeColor: MyColors.authTipColor,size: 20,),
                        Text("我已阅读并同意",style: TextStyle(color:Colors.black,fontSize: 12.sp),),
                        GestureDetector(
                          child: Text("《货物运输协议》",style: TextStyle(color: MyColors.blueColor,fontSize: 12.sp),),
                        ),
                        GestureDetector(
                          child: Text("《ETC取票规则》",style: TextStyle(color: MyColors.blueColor,fontSize: 12.sp),),
                        ),
                      ],
                    ) ,
                    onTap: (){
                      setState(() {
                        isAgree=!isAgree;
                      });
                    },
                  ),
                  SizedBox(height: 10.h,),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      BrnSmallOutlineButton(
                        title: '取消运单',
                        lineColor: MyColors.themeColor,
                        textColor: MyColors.themeColor,
                        radius: 30,
                        width: 140.w,
                        onTap: () {
                          showDialog(
                            barrierDismissible: false,
                            context: context,
                            builder: (BuildContext context) {
                              return BrnDialog(
                                titleText: "温馨提示",
                                messageText: "是否确认取消当前协议？",
                                actionsWidget: [
                                  TextButton(
                                    onPressed: () {
                                      Navigator.pop(context);
                                    },
                                    child: Text("取消",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  ),
                                  TextButton(
                                    onPressed: () {
                                      getApiManager.getData(
                                        context, // 上下文对象，用于显示提示信息等
                                        'api/waybill/contract/refuse', // 您的API端点
                                        {"id":dataMap['contract']['id']}, // 查询参数，如果没有可以传递null
                                            (responseData)  {
                                          BrnToast.show(
                                            "操作成功",
                                            context,
                                            duration: BrnDuration.short,
                                          );
                                          Navigator.pushReplacement(
                                            context,
                                            MaterialPageRoute(builder: (context) => TabbarView(pateIndex: 2,),fullscreenDialog: true,),
                                          );
                                        },
                                      );
                                    },
                                    child: Text("确认",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  ),
                                ],
                              );
                            },
                          );
                        },
                      ),
                      SizedBox(width: 10.w,),
                      BrnSmallMainButton(
                        title: '联系司机',
                        bgColor:MyColors.themeColor,
                        radius: 30,
                        fontSize: 16.sp,
                        width: 140.w,
                        onTap: () async {
                          _makePhoneCall(dataMap['contract']['contractInfo']['driverInfo']['phoneNum']);
                        },
                      ),
                    ],
                  ),
                ],
              ),
           
            ),
        ],
      ),


    );
  }
}
class ChangeSheet extends StatefulWidget {
  const ChangeSheet({super.key, required this.dataMap});
  final Map dataMap;
  @override
  State<ChangeSheet> createState() => _ChangeSheetState();
}

class _ChangeSheetState extends State<ChangeSheet> {
  
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    print(widget.dataMap['contract']['updateInfo']['remark']);
  }
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return Container(
      padding: EdgeInsets.only(left: 10.w,right: 10.w,top: 10.h),
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(10))),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              SizedBox(width: 20.w,),
              Text("协议已产生了修改",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
              GestureDetector(
                  child: Icon(Icons.close,color: MyColors.textColor,size: 30,),
                  onTap:(){
                    Navigator.pop(context);
                  }
              ),
            ],
          ),
          Center(child:  Text("请核实修改的信息后,再确认协议",style: TextStyle(color: MyColors.textColor,fontSize: 12.sp),),),
          Divider(height: 16.h,color: MyColors.backgreyColor,),
          Container(
            height: screenSize.height/2-70.h,
            child: ListView(
              children: [
                if(widget.dataMap['contract']['updateInfo']['freight']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("运费",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['freight']['after']+"元",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['freight']['before']+"元",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 2.0,    ),),
                                ],
                              ),
                              SizedBox(),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['payPeriod']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("付款周期",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  if(int.parse(widget.dataMap['contract']['updateInfo']['payPeriod']['after'])<366)
                                    Text(widget.dataMap['contract']['updateInfo']['payPeriod']['after']+"天后付款",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['after']=="801")
                                    Text("货到付",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['after']=="802")
                                    Text("回单付",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['after']=="830")
                                    Text("月结",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['after']=="890")
                                    Text("季结",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['after']=="980")
                                    Text("半年结",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  if(int.parse(widget.dataMap['contract']['updateInfo']['payPeriod']['before'])<366)
                                    Text(widget.dataMap['contract']['updateInfo']['payPeriod']['before']+"天后付款",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['before']=="801")
                                    Text("货到付",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['before']=="802")
                                    Text("回单付",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['before']=="830")
                                    Text("月结",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['before']=="890")
                                    Text("季结",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                  if(widget.dataMap['contract']['updateInfo']['payPeriod']['before']=="980")
                                    Text("半年结",style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 2.0,    ),),
                                ],
                              ),
                              SizedBox(),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['loadTime']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("装货时间",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadTime']['after']['day']+" "+widget.dataMap['contract']['updateInfo']['loadTime']['after']['time'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadTime']['before']['day']+" "+widget.dataMap['contract']['updateInfo']['loadTime']['before']['time'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                ],
                              ),
                              SizedBox(),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['unloadTime']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("卸货时间",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadTime']['after']['day']+" "+widget.dataMap['contract']['updateInfo']['unloadTime']['after']['time'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadTime']['before']['day']+" "+widget.dataMap['contract']['updateInfo']['unloadTime']['before']['time'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                ],
                              ),
                              SizedBox(),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['loadPlace']!=null)
                  Container(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("装货地址",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          width: screenSize.width-20.w,
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadPlace']['after'][0]['city']+" "+widget.dataMap['contract']['updateInfo']['loadPlace']['after'][0]['county'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadPlace']['after'][0]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                ],
                              ),
                              SizedBox(height: 4.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadPlace']['before'][0]['city']+" "+widget.dataMap['contract']['updateInfo']['loadPlace']['before'][0]['county'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                  Text(widget.dataMap['contract']['updateInfo']['loadPlace']['before'][0]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                ],
                              ),
                              if(widget.dataMap['contract']['updateInfo']['loadPlace']['before'].length==2)
                                Container(
                                  child: Column(
                                    children: [
                                      SizedBox(height: 4.h,),
                                      Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        children: [
                                          Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['loadPlace']['after'][1]['city']+" "+widget.dataMap['contract']['updateInfo']['loadPlace']['after'][1]['county'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['loadPlace']['after'][1]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                        ],
                                      ),
                                      SizedBox(height: 4.h,),
                                      Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        children: [
                                          Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['loadPlace']['before'][1]['city']+" "+widget.dataMap['contract']['updateInfo']['loadPlace']['before'][1]['county'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                            decorationColor: Colors.black, // 可选：横线颜色
                                            decorationThickness: 1.0,    ),),
                                          Text(widget.dataMap['contract']['updateInfo']['loadPlace']['before'][1]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp, decoration: TextDecoration.lineThrough,
                                            decorationColor: Colors.black, // 可选：横线颜色
                                            decorationThickness: 1.0,    ),),
                                        ],
                                      ),
                                    ],
                                  ),
                                ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['unloadPlace']!=null)
                  Container(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("卸货地址",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          width: screenSize.width-20.w,
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][0]['city']+" "+widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][0]['county'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][0]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                ],
                              ),
                              SizedBox(height: 4.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][0]['city']+" "+widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][0]['county'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                  Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][0]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                ],
                              ),
                              if(widget.dataMap['contract']['updateInfo']['unloadPlace']['before'].length==2)
                                Container(
                                  child: Column(
                                    children: [
                                      SizedBox(height: 4.h,),
                                      Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        children: [
                                          Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][1]['city']+" "+widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][1]['county'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['after'][1]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp),),
                                        ],
                                      ),
                                      SizedBox(height: 4.h,),
                                      Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        children: [
                                          Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                          Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][1]['city']+" "+widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][1]['county'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                            decorationColor: Colors.black, // 可选：横线颜色
                                            decorationThickness: 1.0,    ),),
                                          Text(widget.dataMap['contract']['updateInfo']['unloadPlace']['before'][1]['address'],style: TextStyle(color: MyColors.textColor,fontSize: 13.sp, decoration: TextDecoration.lineThrough,
                                            decorationColor: Colors.black, // 可选：横线颜色
                                            decorationThickness: 1.0,    ),),
                                        ],
                                      ),
                                    ],
                                  ),
                                ),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['vehicleLength']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("车长车型",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text((widget.dataMap['contract']['updateInfo']['vehicleLength']['after']).replaceAll(',', '米,')+"/"+widget.dataMap['contract']['updateInfo']['vehicleModel']['after'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Text(widget.dataMap['contract']['updateInfo']['vehicleLength']['before']+","+widget.dataMap['contract']['updateInfo']['vehicleModel']['before'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                    decorationColor: Colors.black, // 可选：横线颜色
                                    decorationThickness: 1.0,    ),),
                                ],
                              ),
                              SizedBox(),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                if(widget.dataMap['contract']['updateInfo']['remark']!=null)
                  Container(
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Container(width: 2.w,height: 10.h,color: Colors.black,),
                            SizedBox(width: 4.w,),
                            Text("补充信息",style: TextStyle(color: Colors.black,fontSize: 14.sp,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Container(
                          width: screenSize.width-20.w,
                          padding: EdgeInsets.all(10.w),
                          decoration: BoxDecoration(
                              color: MyColors.backgreyColor,
                              borderRadius: BorderRadius.all(Radius.circular(10))),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("修改为",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Container(
                                    width: screenSize.width-20.w,
                                    child:Text(widget.dataMap['contract']['updateInfo']['remark']['after'],style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  )
                                ],
                              ),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text("原信息",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                                  Container(
                                    width: screenSize.width-20.w,
                                    child:Text(widget.dataMap['contract']['updateInfo']['remark']['before']=="null"?"无":widget.dataMap['contract']['updateInfo']['remark']['before'],style: TextStyle(color: Colors.black,fontSize: 14.sp, decoration: TextDecoration.lineThrough,
                                      decorationColor: Colors.black, // 可选：横线颜色
                                      decorationThickness: 1.0,    ),),
                                  ),

                                ],
                              ),

                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
              ],
            ),
          ),

        ],
      ),
    );
  }
}
